package br.org.ifrr.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;

@Entity
@Table(name = "gestor")
public class Gestor implements Serializable {

	private static final long serialVersionUID = 1L;

	private Long id;
	private String nome;
	private TipoDepartamento departamento;
	private String setor;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "gest_id")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@NotNull
	@NotBlank
	@Column(name = "gest_nome", length = 100, nullable = false)
	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	@NotNull
	@Enumerated(EnumType.STRING)
	@Column(nullable = false, length = 20, name = "gest_departamento")
	public TipoDepartamento getDepartamento() {
		return departamento;
	}

	public void setDepartamento(TipoDepartamento departamento) {
		this.departamento = departamento;
	}

	@NotNull
	@NotBlank
	@Column(name = "gest_setor", length = 100, nullable = false)
	public String getSetor() {
		return setor;
	}

	public void setSetor(String setor) {
		this.setor = setor;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Gestor other = (Gestor) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

}
